Hệ thống quản lý phòng khám trực tuyến bằng PHP
1 <?php if(!isset($Translation)){ @header('Location: index.php'); exit; } ?>
2 <?php include_once("{$currDir}/header.php"); ?>
3 <?php @include("{$currDir}/hooks/links-home.php"); ?>
4
5 <?php
6 /*
7 Classes of first and other blocks
8 ---------------------------------
9 For possible classes, refer to the Bootstrap grid columns, panels and buttons documentation:
10 Grid columns: http://getbootstrap.com/css/#grid
11 Panels: http://getbootstrap.com/components/#panels
12 Buttons: http://getbootstrap.com/css/#buttons
13 */
14 $block_classes = array(
15 'first' => array(
16 'grid_column' => 'col-sm-12 col-md-8 col-lg-6',
17 'panel' => 'panel-warning',
18 'link' => 'btn-warning'
19 ),
20 'other' => array(
21 'grid_column' => 'col-sm-6 col-md-4 col-lg-3',
22 'panel' => 'panel-info',
23 'link' => 'btn-info'
24 )
25 );
26 ?>
27
28 <style>
29 .panel-body-description{
30 margin-top: 10px;
31 height: 100px;
32 overflow: auto;
33 }
34 .panel-body .btn img{
35 margin: 0 10px;
36 max-height: 32px;
37 }
38 </style>
39
40
41 <?php
42 /* accessible tables */
43 $arrTables = getTableList();
44 if(is_array($arrTables) && count($arrTables)){
45 /* how many table groups do we have? */
46 $groups = get_table_groups();
47 $multiple_groups = (count($groups) > 1 ? true : false);
48
49 /* construct $tg: table list grouped by table group */
50 $tg = array();
51 if(count($groups)){
52 foreach($groups as $grp => $tables){
53 foreach($tables as $tn){
54 $tg[$tn] = $grp;
55 }
56 }
57 }
58
59 $i = 0; $current_group = '';
60 foreach($tg as $tn => $tgroup){
61 $tc = $arrTables[$tn];
62 /* is the current table filter-first? */
63 $tChkFF = array_search($tn, array());
64 /* hide current table in homepage? */
65 $tChkHL = array_search($tn, array('medical_records'));
66 /* allow homepage 'add new' for current table? */
67 $tChkAHAN = array_search($tn, array());
68
69 $t_perm = getTablePermissions($tn);
70 $can_insert = $t_perm['insert'];
71
72 $searchFirst = (($tChkFF !== false && $tChkFF !== null) ? '?Filter_x=1' : '');
73 ?>
74 <?php if(!$i && !$multiple_groups){ /* no grouping, begin row */ ?>
75
76 <div class="row table_links">
77 <?php } ?>
78 <?php if($multiple_groups && $current_group != $tgroup){ /* grouping, begin group & row */ ?>
79 <?php if($current_group != ''){ /* not first group, so we should first end previous group */ ?>
80
81 </div><!-- /.table_links -->
82 <div class="row custom_links">
83 <?php
84 /* custom home links for current group, as defined in "hooks/links-home.php" */
85 echo get_home_links($homeLinks, $block_classes['other'], $current_group);
86 ?>
87 </div>
88 </div><!-- /.collapse -->
89 <?php } ?>
90 <?php $current_group = $tgroup; ?>
91
92 <a class="btn btn-primary btn-block btn-lg collapser vspacer-lg" data-toggle="collapse" href="#group-<?php echo md5($tgroup); ?>"><?php echo $tgroup; ?> <i class="glyphicon glyphicon-chevron-right"></i></a>
93 <div class="collapse" id="group-<?php echo md5($tgroup); ?>">
94 <div class="row table_links">
95 <?php } ?>
96
97 <?php if($tChkHL === false || $tChkHL === null){ /* if table is not set as hidden in homepage */ ?>
98 <div id="<?php echo $tn; ?>-tile" class="<?php echo (!$i ? $block_classes['first']['grid_column'] : $block_classes['other']['grid_column']); ?>">
99 <div class="panel <?php echo (!$i ? $block_classes['first']['panel'] : $block_classes['other']['panel']); ?>">
100 <div class="panel-body">
101 <?php if($can_insert && $tChkAHAN !== false && $tChkAHAN !== null){ ?>
102
103 <div class="btn-group" style="width: 100%;">
104 <a style="width: 85%;" class="btn btn-lg <?php echo (!$i ? $block_classes['first']['link'] : $block_classes['other']['link']); ?>" title="<?php echo preg_replace("/&(#[0-9]+|[a-z]+);/i", "&$1;", html_attr(strip_tags($tc[1]))); ?>" href="<?php echo $tn; ?>_view.php<?php echo $searchFirst; ?>"><?php echo ($tc[2] ? '<img src="' . $tc[2] . '">' : '');?><strong><?php echo $tc[0]; ?></strong></a>
105 <a id="<?php echo $tn; ?>_add_new" style="width: 15%;" class="btn btn-add-new btn-lg <?php echo (!$i ? $block_classes['first']['link'] : $block_classes['other']['link']); ?>" title="<?php echo html_attr($Translation['Add New']); ?>" href="<?php echo $tn; ?>_view.php?addNew_x=1"><i style="vertical-align: bottom;" class="glyphicon glyphicon-plus"></i></a>
106 </div>
107 <?php }else{ ?>
108
109 <a class="btn btn-block btn-lg <?php echo (!$i ? $block_classes['first']['link'] : $block_classes['other']['link']); ?>" title="<?php echo preg_replace("/&(#[0-9]+|[a-z]+);/i", "&$1;", html_attr(strip_tags($tc[1]))); ?>" href="<?php echo $tn; ?>_view.php<?php echo $searchFirst; ?>"><?php echo ($tc[2] ? '<img src="' . $tc[2] . '">' : '');?><strong><?php echo $tc[0]; ?></strong></a>
110 <?php } ?>
111
112 <div class="panel-body-description"><?php echo $tc[1]; ?></div>
113 </div>
114 </div>
115 </div>
116 <?php } ?>
117 <?php if($i == (count($arrTables) - 1) && !$multiple_groups){ /* no grouping, end row */ ?>
118
119 </div> <!-- /.table_links -->
120
121 <div class="row custom_links" id="custom_links">
122 <?php
123 /* custom home links, as defined in "hooks/links-home.php" */
124 echo get_home_links($homeLinks, $block_classes['other'], '*');
125 ?>
126 </div>
127
128 <?php } ?>
129 <?php if($i == (count($arrTables) - 1) && $multiple_groups){ /* grouping, end last group & row */ ?>
130
131 </div> <!-- /.table_links -->
132 <div class="row custom_links" id="custom_links">
133 <?php
134 /* custom home links for last table group, as defined in "hooks/links-home.php" */
135 echo get_home_links($homeLinks, $block_classes['other'], $tgroup);
136
137 /* custom home links having no table groups, as defined in "hooks/links-home.php" */
138 echo get_home_links($homeLinks, $block_classes['other']);
139 ?>
140 </div>
141 </div><!-- /.collapse -->
142 <?php } ?>
143 <?php
144 $i++;
145 }
146 }else{
147 ?><script>window.location='index.php?signIn=1';</script><?php
148 }
149 ?>
150
151 <script>
152 $j(function(){
153 var table_descriptions_exist = false;
154 $j('div[id$="-tile"] .panel-body-description').each(function(){
155 if($j.trim($j(this).html()).length) table_descriptions_exist = true;
156 });
157
158 if(!table_descriptions_exist){
159 $j('div[id$="-tile"] .panel-body-description').css({height: 'auto'});
160 }
161
162 $j('.panel-body .btn').height(32);
163
164 $j('.btn-add-new').click(function(){
165 var tn = $j(this).attr('id').replace(/_add_new$/, '');
166 modal_window({
167 url: tn + '_view.php?addNew_x=1&Embedded=1',
168 size: 'full',
169 title: $j(this).prev().text() + ": <?php echo html_attr($Translation['Add New']); ?>"
170 });
171 return false;
172 });
173
174 /* adjust arrow directions on opening/closing groups, and initially open first group */
175 $j('.collapser').click(function(){
176 $j(this).children('.glyphicon').toggleClass('glyphicon-chevron-right glyphicon-chevron-down');
177 });
178
179 /* hide empty table groups */
180 $j('.collapser').each(function(){
181 var target = $j(this).attr('href');
182 if(!$j(target + " .row div").length) $j(this).hide();
183 });
184 $j('.collapser:visible').eq(0).click();
185 });
186 </script>
187
188 <?php include_once("$currDir/footer.php"); ?>